#include <bits/stdc++.h>
using namespace std;
/*
https://www.nowcoder.com/questionTerminal/3d8b7e706ca9429eacd6c405713ba11d?orderByHotValue=1&mutiTagIds=2656&page=1&onlyReference=false
*/
int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    int i,j;
    long long bnum=0,ans=0,mod=1000000007;
    string s;
    cin>>s;
    for(i=s.size()-1;i>=0;i--)
    {
        if(s[i]=='b')
            bnum++;
        else if(s[i]=='a')
        {
            ans=(ans+bnum)%mod;
            bnum=bnum*2%mod;
        }
    }
    cout<<ans;
    return 0;
}
